/**
 * Return an array of arrays of size *returnSize.
 * The sizes of the arrays are returned as *returnColumnSizes array.
 * Note: Both returned array and *columnSizes array must be malloced, assume caller calls free().
 */
int** generate(int numRows, int* returnSize, int** returnColumnSizes)
{
    int ** array=(int **)malloc( numRows * sizeof(int* ));
    for(int i=1;i < numRows+1;++i)
    {
        array[i-1]=(int *)malloc( i * sizeof( int )); 
    } 
    *returnSize=numRows;
    *returnColumnSizes= malloc(numRows * sizeof(int));
    //申请空间
    for(int j=0;j< numRows;j++)
    {
        array[j][j]=1;
        array[j][0]=1;
        (*returnColumnSizes)[j] = j+1;
    }
    //赋初值
    for(int k=2;k<numRows;k++)
    {
        for(int t=1;t<k;t++)
            array[k][t]=array[k-1][t-1]+array[k-1][t];
    }

    return array;
}